#include <iostream>
#include <memory>
#include "udp_server.hpp"

//./server serverip serverport
int main(int argc, char* argv[])
{
    if (argc != 2) //if (argc != 3)
    {
        std::cout << "Usage: ./xxx serverport" << std::endl;//std::cout << "Usage: ./xxx serverip serverport" << std::endl;
        exit(-1);
    }
    //std::string lockip = argv[1];
    uint16_t lockport = std::stoi(argv[1]);

    // UdpServer server;
    // server.InitServer(lockport);
    // server.Start();
    //std::unique_ptr<UdpServer> up_udpser = std::make_unique<UdpServer>();//make_unique是C++14的
    std::unique_ptr<UdpServer> up_udpser(new UdpServer);//make_unique是C++14的
    up_udpser->InitServer(lockport);
    up_udpser->Start();
    
    return 0;
}